<template>
  <div class="TMB-warp">
    <div class="titler border-bottom">
      <span class="font-w fs16">経歴データ纏め方法</span>
      <i class="el-icon-close" @click="CloseTables"></i>
    </div>
    <div class="middle-box">
      <el-radio v-for="(i, v) in MSInfo.typeList" :key="v" v-model="MSInfo.currentType.key" :label="i.key">{{ i.label
        }}</el-radio>

    </div>
    <div class="footer border-top">
      <span class="font-w">上記の内容で良いですか?</span>
      <div>
        <el-button @click="CloseTables">Cancel</el-button>
        <el-button type="primary" @click="SaveVisualDetailPlanDetecionTypeApi">OK</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { GetVisualDetailPlanDetecionType, SaveVisualDetailPlanDetecionType } from '@/api/api'
import eventBus from "@/eventBus/bus";
import { getLocalStorage } from "@/utils/storage";

export default {
  name: "MSComponent",
  props: {

  },
  data() {
    return {
      MSInfo: {}

    };
  },
  components: {},
  watch: {},
  methods: {
    async GetVisualDetailPlanDetecionTypeApi() {
      let dataJson = {
        Acc: getLocalStorage("userName"),
      }
      let res = await GetVisualDetailPlanDetecionType(dataJson);
      console.log(res, "获取 経歴データ纏め方法設定画面和初始选择项")
      if (res.data.code != 0) {
        this.$alert(res.data.msg, '', {
          confirmButtonText: 'OK',
          type: 'warning',
        });

      }
      this.MSInfo = res.data.data;
    },
    async SaveVisualDetailPlanDetecionTypeApi() {

      let Label = this.MSInfo.typeList.find((item) => {
        return item.key == this.MSInfo.currentType.key
      })
      let dataJson = {
        Acc: getLocalStorage("userName"),
        Key: this.MSInfo.currentType.key,
        Label: Label.label
      }
      let res = await SaveVisualDetailPlanDetecionType(dataJson);
      if (res.data.code != 0) {
        return
      }
      this.$message({
        type: 'success',
        message: res.data.msg
      })
      this.$emit('CloseTables')
      console.log(res, "保存 経歴データ纏め方法設定画面和初始选择项")
    },

    CloseTables() {
      this.$emit('CloseTables')
    },
  },
  created() { },
  mounted() {
    this.GetVisualDetailPlanDetecionTypeApi();
  },
  beforeDestroy() { },
  destroyed() { }
};
</script>
<style lang="scss" scoped>
.TMB-warp {
  width: 600px;
  height: 240px;
  background: rgb(255, 255, 255);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  box-shadow: 0px 12px 48px 16px rgba(0, 0, 0, 0.05),
    0px 9px 28px 0px rgba(0, 0, 0, 0.08), 0px 6px 16px -8px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.titler {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 24px;

  i {
    cursor: pointer;
  }
}

.middle-box {
  height: calc(100% - 100px);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 10px 50px;

  .left-box {
    width: 281px;
    padding: 0 24px;
  }

  .right-box {
    width: calc(100% - 281px);
    padding: 0 24px;
  }

  .row {
    padding: 10px 0;
    display: flex;
    align-items: center;

    .el-input {
      width: 70px;
      height: 32px;

      ::v-deep .el-input__inner {
        width: 70px;
        height: 100%;
        text-align: center;
      }
    }

    ::v-deep .el-radio__label {
      font-weight: bold;

    }

    .ipt {
      width: 120px !important;
      height: 32px;
      margin-right: 8px;

      ::v-deep .el-input__inner {
        width: 100%;
        height: 32px;
        padding: 0 8px 0 30px;
      }

      // ::v-deep .el-input__inner:focus {
      //   border: 1px solid #dcdfe6;
      // }
      ::v-deep .el-input__icon {
        line-height: 32px;
        color: #909399;
      }

      ::v-deep .el-input__suffix {
        display: none;
      }
    }
  }
}

.footer {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 24px;

  button {
    width: 82px !important;
    height: 32px;
    // background: #ffffff;
    // border: 1px solid #d9d9d9;
    // cursor: pointer;
    line-height: 0;
  }

  button:nth-child(2) {
    margin-left: 16px;
    // color: #ffffff;
    // background: #106ebe;
  }
}

.font-w {
  font-weight: bold;
}

.border-top {
  border-top: 1px solid #f0f0f0;
}

.border-bottom {
  border-bottom: 1px solid #f0f0f0;
}

.border-left {
  border-left: 1px solid #f0f0f0;
}

.border-right {
  border-right: 1px solid #f0f0f0;
}

.gray {
  color: #7B7B7B;
}

.mar8 {
  margin-right: 8px;
}

.fs16 {
  font-size: 16px;
}
</style>
